-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add warnings for web3.sha3, middleware_stack, and python 3.5 #1020
Conversation
web3/__init__.py
Outdated
"Support for Python 3.5 will be removed in web3.py v5", | ||
category=DeprecationWarning, | ||
stacklevel=2) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted to have both warnings print in the case that the python version is less than 3.5, so that the user doesnt have to update to 3.5 to learn that support for 3.5 will be dropped soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first one is an exception and will exit the python process before hitting this new warning.... so I don't think this behaves as you expect.
a9b97d7
to
f172797
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems pretty straight forward. Pretty quick scan.
web3/__init__.py
Outdated
"Support for Python 3.5 will be removed in web3.py v5", | ||
category=DeprecationWarning, | ||
stacklevel=2) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first one is an exception and will exit the python process before hitting this new warning.... so I don't think this behaves as you expect.
b9aefff
to
5aa2c7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming this is to be merged in before v4 branches off...
We should leave at least a few smoke tests that the old deprecated names still work.
web3/main.py
Outdated
@@ -132,11 +138,12 @@ def providers(self, providers): | |||
self.manager.providers = providers | |||
|
|||
@staticmethod | |||
@deprecated_for("This method has been renamed to web3.keccak") | |||
@apply_to_return_value(HexBytes) | |||
def sha3(primitive=None, text=None, hexstr=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried that in the future we're going to change something in one implementation or the other, instead of both. Can we just make the deprecated version an alias to the new one, like:
def sha3(...):
return Web3.keccak(...)
I think it's okay to have the error message reference keccak instead of sha3 during deprecation time.
Referencing the conversation at the end of #1039. The middleware_stack deprecation warning may need to change or be broken out of this PR. |
5aa2c7f
to
cba7eec
Compare
I remove the commit renaming middleware_stack to middleware_onion, and added a few tests to ensure the deprecated method, Web3.sha3 works as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GTG when CI finishes green 👍
The cryptographic hashing method sha3 was renamed to keccak in PR ethereum#1020 and thus deprecated but the docs were not updated to reflect this.
What was wrong?
Related to Issue #722
How was it fixed?
I lumped together a few of the straight forward deprecation warnings:
Cute Animal Picture